﻿--获取地域补助
CREATE PROCEDURE [dbo].[proc_Employee_Allowance_GetList]
(
	@startIndex int,
	@endIndex int
)
as
	Begin
		;WITH list As(Select ROW_NUMBER() OVER (ORDER BY Id  Asc)AS Row,
		 Id,
		 EAId,
		 AName,
		 Amount,
		 Memo,
		 (Select  p.postname from Post p Where p.Id=Employee_Allowance.PostId) as PostName,
		(Select p.Title From Province p  where p.Id=Employee_Allowance.Pid) as pname,
		(Select c.Title From city c  where c.Id=Employee_Allowance.cid) as cname
--		,(Select Count(Id) From Employee_Allowance Where Id > 762) AS coun
		From 
			Employee_Allowance 
		Where
			Id > 762
		)
		Select   *,(SELECT COUNT(0) FROM list) AS coun From list Where Row between @StartIndex and @EndIndex 
	End
	
RETURN
